home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 March
/
EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso
/
earcd
/
util4
/
fwcalndr.lha
/
FWCalendar
/
AddEvent.rexx
next >
Wrap
OS/2 REXX Batch file
|
1995-10-18
|
6KB
|
172 lines
/* AddEvent Macro
Adds events to calendars created by my
Calendar Macro for FinalWriter3 (SoftWood)
Written by Ronald Goertz
$VER: AddEvent v1.0 (18 Feb 95)
*/
OPTIONS RESULTS
SetMeasure MicroPoints
/* User-defined variables ... these !should! correspond to the variables */
/* used in the Calendar macro */
FullWidth = 11.0
FullHeight = 8.5
TopMargin = 0.5
BottomMargin = 0.2
LeftMargin = 0.6
RightMargin = 0.2
Font = "Work:WP.../FinalWriter/FWFonts/SWOLFonts/SoftSans"
FSize = 8
FWidth = 100
TextOffset = 0.05
/* Program variables */
mpi = 720
TextOffset = trunc(TextOffset * mpi)
FullWidth = trunc(FullWidth * mpi)
FullHeight = trunc(FullHeight * mpi)
TopMargin = trunc(TopMargin * mpi)
BottomMargin = trunc(BottomMargin * mpi)
LeftMargin = trunc(LeftMargin * mpi)
RightMargin = trunc(RightMargin * mpi)
PageWidth = trunc(FullWidth - LeftMargin - RightMargin)
PageHeight = trunc(FullHeight - TopMargin - BottomMargin)
TextArea = trunc(.15 * PageHeight)
BoxWidth = trunc(PageWidth/7)
BoxHeight = trunc((PageHeight-TextArea)/5)
MonthLength.1 = 31
MonthLength.2 = 28
MonthLength.3 = 31
MonthLength.4 = 30
MonthLength.5 = 31
MonthLength.6 = 30
MonthLength.7 = 31
MonthLength.8 = 31
MonthLength.9 = 30
MonthLength.10 = 31
MonthLength.11 = 30
MonthLength.12 = 31
DisplayPrefs GUIDES a
TextBlockTypePrefs COLOR Black
TextBlockTypePrefs SIZE FSize WIDTH FWidth FONT font
BoxPrefs LINEWT Hairline FILL Solid FILLCOLOR White
GetTextBlockText 2
TempDate = RESULT
SelectObject
Month = substr(TempDate,5,2)
if left(Month,1) == "0" then Month = right(Month,1)
PrevMonth = Month - 1
if PrevMonth = 0 then PrevMonth = 12
Year = left(TempDate,4)
if (Year//4 == 0 & Year//100 > 0) | Year//400 == 0 Then MonthLength.2 = 29
StartDate = date('w',TempDate,'S')
Select
When StartDate == "Sunday" Then StartDate = 0
When StartDate == "Monday" Then StartDate = 1
When StartDate == "Tuesday" Then StartDate = 2
When StartDate == "Wednesday" Then StartDate = 3
When StartDate == "Thursday" Then StartDate = 4
When StartDate == "Friday" Then StartDate = 5
When StartDate == "Saturday" Then StartDate = 6
End
Do While 1
Drop RESULT
RequestText '"Event Entry" "Enter event as: Day,Day,Line,Box,Event" ""'
input = RESULT
if input == "RESULT" | input == "" then Exit
Parse Var input Day1 ',' Day2 ',' Line ',' Box ',' Event
Box = left(upper(Box),1)
if Box == 'B' | pos('//',Event) ~= 0 then Box = 'Y'
If Day2 == "DAY2" | Day2 == "" then Day2 = Day1
If upper(left(Day1,1)) == "P" then Day1 = substr(Day1,2) - MonthLength.PrevMonth
If upper(left(Day2,1)) == "P" then Day2 = substr(Day2,2) - MonthLength.PrevMonth
If upper(left(Day1,1)) == "N" then Day1 = substr(Day1,2) + MonthLength.Month
If upper(left(Day2,1)) == "N" then Day2 = substr(Day2,2) + MonthLength.Month
If Day1 > Day2 then Do
TempDate = Day1
Day1 = Day2
Day2 = TempDate
End
If Day1 ~= Day2 then Box = 'Y'
If Day1 <= -StartDate then Do
ShowMessage 1 0 '"Dates cannot come before" "the beginning of the calendar." "" "OK" "" ""'
Exit
End
if ((StartDate + MonthLength.Month > 35) & (Day2 > MonthLength.Month)) | ((StartDate + MonthLength.Month < 36) & (Day2 > 35 - StartDate)) then do
ShowMessage 1 0 '"Dates cannot come after" "the end of the calendar." "" "OK" "" ""'
Exit
End
/*ShowMessage 1 0 ''TextRows' 'Text.TextRows' 'Found' "OK" "" ""'*/
Day1Row = trunc((Day1 + StartDate - 1)/7)
Day2Row = trunc((Day2 + StartDate - 1)/7)
Day1Column = (Day1 + StartDate) - 7*Day1Row - 1
LeftEdge = LeftMargin + Day1Column*BoxWidth + TextOffset
If Day1Row < 5 then PrintRow = Day1Row * BoxHeight
else PrintRow = trunc(4.5 * BoxHeight)
If Box ~= 'Y' then do
TextBottom = TopMargin + TextArea + PrintRow + (Line+1)*FSize*11
TextLeft = LeftMargin + Day1Column*BoxWidth + TextOffset
DrawTextBlock 1 TextLeft TextBottom Event
End
else do until Day1Row > Day2Row
SearchPos = 1
Found = 1
TextRows = 1
do until Found = 0
Found = pos('//',Event,SearchPos)
if Found > 0 then do
Text.TextRows = substr(Event,SearchPos,Found - SearchPos)
SearchPos = Found + 2
TextRows = TextRows + 1
end
else Text.TextRows = substr(Event,SearchPos)
end
if Day2Row > Day1Row then Width = (LeftMargin + 7*BoxWidth) - LeftEdge - 4
else Do
Day2Column = (Day2 + StartDate) - 7*Day2Row - 1
Width = (LeftMargin + (Day2Column + 1)*BoxWidth - TextOffset) - LeftEdge - 2
End
TopEdge = TopMargin + TextArea + PrintRow + Line*FSize*11 + trunc(2.5*FSize)
DrawBox 1 LeftEdge TopEdge Width FSize*11*TextRows
do i = 1 to TextRows
TextBottom = TopMargin + TextArea + PrintRow + (Line+i)*FSize*11
DrawTextBlock 1 1 TextBottom Text.i
ID = RESULT
GetObjectCoords ID
parse var result . . . TextWidth TextHeight
TextLeft = trunc(LeftEdge + (Width - TextWidth)/2)
SetObjectCoords ID 1 TextLeft TextBottom TextWidth TextHeight
end
Day1Row = Day1Row + 1
If Day1Row < 5 then PrintRow = Day1Row * BoxHeight
else PrintRow = trunc(4.5 * BoxHeight)
LeftEdge = LeftMargin - 1
End
Redraw
SelectObject
End